home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 January / macformat-020.iso / Shareware City / Developers / apps.to.go / DTS.StyleChat / WindowPalette.c < prev   
Encoding:
C/C++ Source or Header  |  1994-05-18  |  7.1 KB  |  312 lines  |  [TEXT/MPS ]

  1. /*
  2. ** Apple Macintosh Developer Technical Support
  3. **
  4. ** File:        WindowPalette.c
  5. ** Written by:    Eric Soldan
  6. **
  7. ** Copyright © 1990-1993 Apple Computer, Inc.
  8. ** All rights reserved.
  9. */
  10.  
  11. /* You may incorporate this sample code into your applications without
  12. ** restriction, though the sample code has been provided "AS IS" and the
  13. ** responsibility for its operation is 100% yours.  However, what you are
  14. ** not permitted to do is to redistribute the source as "DSC Sample Code"
  15. ** after having made changes. If you're going to re-distribute the source,
  16. ** we require that you make it clear in the source that the code was
  17. ** descended from Apple Sample Code, but that you've made changes. */
  18.  
  19.  
  20.  
  21. /*****************************************************************************/
  22.  
  23.  
  24.  
  25. #include "App.h"            /* Get the application includes/typedefs, etc.    */
  26. #include "App.protos.h"        /* Get the prototypes for application.            */
  27.  
  28. #ifndef __ERRORS__
  29. #include <Errors.h>
  30. #endif
  31.  
  32. #ifndef __UTILITIES__
  33. #include "Utilities.h"
  34. #endif
  35.  
  36.  
  37.  
  38. /*****************************************************************************/
  39.  
  40.  
  41.  
  42. extern short        gPrintPage;                /* Non-zero means we are printing. */
  43.                                             /* DTS.Lib..framework global. */
  44.  
  45. extern RgnHandle    gCursorRgn;                /* We handle cursors here, so we need */
  46. extern CursPtr        gCursorPtr;                /* to know about these things. */
  47.                                             /* Above are DTS.Lib..framework globals. */
  48.  
  49.  
  50.  
  51. /*****************************************************************************/
  52. /*****************************************************************************/
  53.  
  54.  
  55.  
  56. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  57. /* See CalcFrameRgn() for info. */
  58.  
  59. #pragma segment TheDoc
  60. void    PaletteCalcFrameRgn(FileRecHndl frHndl, WindowPtr window, RgnHandle rgn)
  61. {
  62. #ifndef __MWERKS__
  63. #pragma unused (frHndl, window, rgn)
  64. #endif
  65. }
  66.  
  67.  
  68.  
  69. /*****************************************************************************/
  70.  
  71.  
  72.  
  73. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  74. /* See ContentClick() for info. */
  75.  
  76. #pragma segment TheDoc
  77. void    PaletteContentClick(WindowPtr window, EventRecord *event, Boolean firstClick)
  78. {
  79. #ifndef __MWERKS__
  80. #pragma unused (firstClick)
  81. #endif
  82.  
  83.     ControlHandle    ctl;
  84.     short            action, cnum;
  85.  
  86.     cnum = IsCtlEvent(window, event, &ctl, &action);
  87.     return;
  88. }
  89.  
  90.  
  91.  
  92. /*****************************************************************************/
  93.  
  94.  
  95.  
  96. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  97. /* See ContentKey() for info. */
  98.  
  99. #pragma segment TheDoc
  100. Boolean    PaletteContentKey(WindowPtr window, EventRecord *event, Boolean *passThrough)
  101. {
  102. #ifndef __MWERKS__
  103. #pragma unused (passThrough)
  104. #endif
  105.  
  106.     short    cnum;
  107.  
  108.     cnum = IsCtlEvent(window, event, nil, nil);
  109.     if (!cnum) {
  110.         *passThrough = true;
  111.         return(false);
  112.     }
  113.  
  114.     return(true);
  115. }
  116.  
  117.  
  118.  
  119. /*****************************************************************************/
  120.  
  121.  
  122.  
  123. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  124. /* See DrawFrame() for info. */
  125.  
  126. #pragma segment TheDoc
  127. void    PaletteDrawFrame(FileRecHndl frHndl, WindowPtr window, Boolean activate)
  128. {
  129.     MoveTo(0, (*frHndl)->fileState.topSidebar - 1);
  130.     LineTo((*frHndl)->fileState.leftSidebar - 1 - 16384, (*frHndl)->fileState.topSidebar - 1);
  131.     LineTo((*frHndl)->fileState.leftSidebar - 1 - 16384, 16383);
  132.  
  133.     BeginFrame(window);
  134.     DoDrawControls(window, activate);
  135.     EndFrame(window);
  136. }
  137.  
  138.  
  139.  
  140. /*****************************************************************************/
  141.  
  142.  
  143.  
  144. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  145. /* See FreeDocument() for info. */
  146.  
  147. #pragma segment TheDoc
  148. OSErr    PaletteFreeDocument(FileRecHndl frHndl)
  149. {
  150.     return(DefaultFreeDocument(frHndl));
  151. }
  152.  
  153.  
  154.  
  155. /*****************************************************************************/
  156.  
  157.  
  158.  
  159. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  160. /* See FreeWindow() for info. */
  161.  
  162. #pragma segment TheDoc
  163. OSErr    PaletteFreeWindow(FileRecHndl frHndl, WindowPtr window)
  164. {
  165. #ifndef __MWERKS__
  166. #pragma unused (frHndl, window)
  167. #endif
  168.  
  169.     return(noErr);
  170. }
  171.  
  172.  
  173.  
  174. /*****************************************************************************/
  175.  
  176.  
  177.  
  178. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  179. /* See ImageDocument() for info. */
  180.  
  181. #pragma segment TheDoc
  182. OSErr    PaletteImageDocument(FileRecHndl frHndl)
  183. {
  184. #ifndef __MWERKS__
  185. #pragma unused (frHndl)
  186. #endif
  187.  
  188.     WindowPtr    curPort;
  189.  
  190.     GetPort(&curPort);
  191.     if (!gPrintPage) {                                    /* If not printing... */
  192.         DoDrawControls(curPort, false);                    /* Draw the content controls. */
  193.     }
  194.  
  195.     return(noErr);
  196. }
  197.  
  198.  
  199.  
  200. /*****************************************************************************/
  201.  
  202.  
  203.  
  204. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  205. /* See InitContent() for info. */
  206.  
  207. #pragma segment TheDoc
  208. OSErr    PaletteInitContent(FileRecHndl frHndl, WindowPtr window)
  209. {
  210.     OSErr    err;
  211.  
  212.     err = AddControlSet(window, (*frHndl)->fileState.sfType, kwStandardVis, 0, 0, nil);
  213.     return(err);
  214. }
  215.  
  216.  
  217.  
  218. /*****************************************************************************/
  219.  
  220.  
  221.  
  222. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  223. /* See ResizeContent() for info. */
  224.  
  225. #pragma segment TheDoc
  226. void    PaletteResizeContent(WindowPtr window, short oldh, short oldv)
  227. {
  228. #ifndef __MWERKS__
  229. #pragma unused (window, oldh, oldv)
  230. #endif
  231.  
  232.     /* See DTS.Chat for a sample usage of this function. */
  233. }
  234.  
  235.  
  236.  
  237. /*****************************************************************************/
  238.  
  239.  
  240.  
  241. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  242. /* See ScrollFrame() for info. */
  243.  
  244. #pragma segment TheDoc
  245. void    PaletteScrollFrame(FileRecHndl frHndl, WindowPtr window, long dh, long dv)
  246. {
  247. #ifndef __MWERKS__
  248. #pragma unused (frHndl, window, dh, dv)
  249. #endif
  250. }
  251.  
  252.  
  253.  
  254. /*****************************************************************************/
  255.  
  256.  
  257.  
  258. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  259. /* See UndoFixup() for info. */
  260.  
  261. #pragma segment TheDoc
  262. void    PaletteUndoFixup(FileRecHndl frHndl, Point contOrg, Boolean afterUndo)
  263. {
  264. #ifndef __MWERKS__
  265. #pragma unused (frHndl, contOrg, afterUndo)
  266. #endif
  267.  
  268.     /* See DTS.Draw for an example of what you might do here. */
  269. }
  270.  
  271.  
  272.  
  273. /*****************************************************************************/
  274.  
  275.  
  276.  
  277. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  278. /* See WindowCursor() for info. */
  279.  
  280. #pragma segment TheDoc
  281. Boolean    PaletteWindowCursor(FileRecHndl frHndl, WindowPtr window, Point globalPt)
  282. {
  283. #ifndef __MWERKS__
  284. #pragma unused (frHndl, window, globalPt)
  285. #endif
  286.  
  287.     /* For examples of applications that have non-arrow cursor regions,
  288.     ** see DTS.Chat and DTS.Draw. */
  289.  
  290.     DoSetCursor(&qd.arrow);
  291.     return(true);
  292. }
  293.  
  294.  
  295.  
  296. /*****************************************************************************/
  297.  
  298.  
  299.  
  300. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  301. /* See WindowGoneFixup() for info. */
  302.  
  303. #pragma segment TheDoc
  304. void    PaletteWindowGoneFixup(WindowPtr window)
  305. {
  306. #ifndef __MWERKS__
  307. #pragma unused (window)
  308. #endif
  309. }
  310.  
  311.  
  312.